package gredis

import (
	"fmt"

	"github.com/redis/go-redis/v9"
)

type Client struct {
	rdb *redis.Client
}

func NewClient(opt *Options) *Client {
	c := &Client{}

	c.rdb = redis.NewClient(&redis.Options{
		Addr:         opt.Addr,
		Password:     opt.Password,
		DB:           opt.DB,
		PoolSize:     opt.PoolSize,
		MinIdleConns: opt.MinIdleConns,
		MaxIdleConns: opt.MaxIdleConns,
		DialTimeout:  opt.DialTimeout,
	})

	fmt.Printf(">>> opt: %+v\n", c.rdb.Options())

	return c
}

func (c *Client) Close() error {
	return c.rdb.Close()
}
